function [x_recon returnpara] = sartReconIter(parameter,prjimg, x0, iterNum);
%reshape prjimg
nd = length(parameter.y_det);
viewnum = length(parameter.sd_phi);
prjimg = reshape(prjimg,nd,viewnum);

nt = 1;
para = parameter;

%parameter setting for view by view update
inv=1;% number of views (projections)
Id_v=cell(1,nt);
Id_v{1}=uint32(0:inv-1);
id_X=[];Nv=zeros(1,nt);
for i=1:nt
    id_X=[id_X (i-1)*ones(1,numel(Id_v{i}))];
    Nv(i)=numel(Id_v{i});
end
tmp_size=max(Nv);
id_Y=zeros(tmp_size,nt);
for i=1:nt
    id_Y(1:Nv(i),i)=Id_v{i};
end

para.nv = uint32(1);
para.Nv =uint32(1);
para.tmp_size = uint32(1);
para.id_X = uint32(id_X);
para.id_Y = uint32(id_Y);
angle_det=atan2(para.y_det,para.SO+para.OD);
para.cos_det=cos(angle_det);para.sin_det=sin(angle_det);
angle_det2=atan2(para.y_det2,para.SO+para.OD);
para.cos_det2=single(cos(angle_det2));para.sin_det2=single(sin(angle_det2));% for finite-size beam
sd_phi = parameter.sd_phi;



x_recon = x0;


%sart recon
for iter = 1:iterNum
   
    for index = 1:viewnum
        
        para.sd_phi=sd_phi(index);
        para.cos_phi=cos(sd_phi(index));
        para.sin_phi=sin(sd_phi(index));
        para.version=uint32(0);para.GPU=uint32(0);
        recon_weighting  = single(zeros(size(x0)));
        rasidual = weighted_Ax_fan_mf(x_recon,para,prjimg(:,index),recon_weighting);
        
        t=(recon_weighting==0);
        recon_weighting(t) = 1;
        para.version=uint32(1);para.GPU=uint32(1);
        x_recon = x_recon +   Atx_fan_mf(rasidual,para)./recon_weighting;
        
       
        
    end
end

returnpara = para;

end